Update the position after showing the window since the window manager
authorRichard Hult <richard@imendio.com>
Sun, 17 Feb 2008 10:11:11 +0000 (10:11 +0000)
committerRichard Hult <rhult@src.gnome.org>
Sun, 17 Feb 2008 10:11:11 +0000 (10:11 +0000)
2008-02-17  Richard Hult  <richard@imendio.com>

* gdk/quartz/GdkQuartzWindow.c: (showAndMakeKey): Update the
position after showing the window since the window manager might
not place it where we requested in the first places.

svn path=/trunk/; revision=19605

ChangeLog
gdk/quartz/GdkQuartzWindow.c

index 731fa6b501ac58f392e1f905c986bb0c23e6b66a..dee6725240fc8d7876fe0c9f177ee5f6d5e094cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-17  Richard Hult  <richard@imendio.com>
+
+       * gdk/quartz/GdkQuartzWindow.c: (showAndMakeKey): Update the
+       position after showing the window since the window manager might
+       not place it where we requested in the first places.
+
 2008-02-17  Richard Hult  <richard@imendio.com>
 
        * gdk/quartz/gdkwindow-quartz.c: (show_window_internal),
index e8aca4c2981111343c3b0e33fcb0550c5d40032a..95cf0285677688b73959653837735330e1f1666a 100644 (file)
   GdkWindow *window = [[self contentView] gdkWindow];
   GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+  gboolean was_hidden;
+  int requested_x = 0, requested_y = 0;
 
   inShowOrHide = YES;
+  was_hidden = FALSE;
 
   if (!GDK_WINDOW_IS_MAPPED (window))
     {
       NSRect content_rect;
       NSRect frame_rect;
 
+      was_hidden = TRUE;
+
       /* We move the window in place if it's not mapped. See comment in
        * hide().
        */
                     impl->width, impl->height);
       frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
       [impl->toplevel setFrame:frame_rect display:NO];
+
+      requested_x = frame_rect.origin.x;
+      requested_y = frame_rect.origin.y;
     }
 
   if (makeKey)
     [impl->toplevel orderFront:nil];
 
   inShowOrHide = NO;
+
+  /* When the window manager didn't allow our request, update the position
+   * to what it really ended up as.
+   */
+  if (was_hidden)
+    {
+      NSRect frame_rect;
+
+      frame_rect = [impl->toplevel frame];
+      if (requested_x != frame_rect.origin.x || requested_y != frame_rect.origin.y)
+        {
+          [self windowDidMove:nil];
+        }
+    }
 }
 
 - (void)hide
 }
 
 
+
 static GdkDragContext *current_context = NULL;
 
 static GdkDragAction